package com.easyadmin.entity.enums;

import com.easyadmin.entity.vo.EnumVO;

import java.util.ArrayList;
import java.util.List;

/**
 * 菜单权限编码
 */
public enum PermissionCodeEnum {
    NO_PERMISSION("no_permission", "不校验权限"),

    HOME("home", "首页"),

    SETTINGS("settings", "系统设置"),
    SETTINGS_MENU("settings_menu", "菜单列表"),
    SETTINGS_MENU_EDIT("settings_menu_edit", "新增/修改菜单"),
    SETTINGS_MENU_DEL("settings_menu_del", "删除菜单"),

    SETTINGS_ACCOUNT("settings_account", "账号设置"),
    SETTINGS_ACCOUNT_EDIT("settings_account_edit", "新增/修改账号"),
    SETTINGS_ACCOUNT_DEL("settings_account_del", "删除账号"),
    SETTINGS_ACCOUNT_UPDATE_PASSWORD("settings_account_update_password", "修改账号密码"),
    SETTINGS_ACCOUNT_OP_STATUS("settings_account_op_status", "启用/禁用账号"),

    SETTINGS_DIC("settings_dic", "字典管理"),
    SETTINGS_DIC_EDIT("settings_dic_edit", "新增/修改字典"),
    SETTINGS_DIC_DEL("settings_dic_del", "删除字典"),

    SETTINGS_ROLE("settings_role", "角色列表"),
    SETTINGS_ROLE_EDIT("settings_role_edit", "新增/修改角色"),
    SETTINGS_ROLE_DEL("settings_role_del", "删除角色"),

    SETTINGS_OPERLOG("settings_operlog", "操作日志"),

    TASK("task", "定时任务管理"),
    TASK_LIST("task_list", "定时任务"),
    TASK_EDIT("task_edit", "新增/修改定时任务"),
    TASK_DEL("task_del", "删除定时任务"),
    TASK_LOG("task_log", "查看任务日志");

    private String code;
    private String desc;


    PermissionCodeEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public String getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    public static List<EnumVO> getDataList() {
        List<EnumVO> dataList = new ArrayList<>();
        for (PermissionCodeEnum item : PermissionCodeEnum.values()) {
            dataList.add(new EnumVO(item.code, item.desc));
        }
        return dataList;
    }
}
